﻿
using System;
using System.Diagnostics;


namespace CrazyMan.TM.Interface.Domain
{
    /// <summary>
    /// Represents a playing chip.
    /// </summary>
    [DebuggerDisplay("${Value}")]
    public class Chip
    {
        private int _value;

        /// <summary>
        /// Creates a new playing chip with a specified value.
        /// </summary>
        /// <param name="value">The value of the chip.</param>
        public Chip(int value)
        {
            ValidateValue(value);

            this._value = value;
        }

        /// <summary>
        /// Gets the value of the chip.
        /// </summary>
        public int Value
        {
            get { return this._value; }
        }

        /// <summary>
        /// Validates that the value of the chip is legal.
        /// </summary>
        /// <param name="value">The value to be validated.</param>
        protected void ValidateValue(int value)
        {
            if (value <= 0)
                throw new ArgumentOutOfRangeException("The chip value must be greater than zero.");
        }
    }
}
